<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta content="width=device-width,initial-scale=1.0,maxinmum-scale=1.0,user-scalable=0" name="viewport">
    <title>Prest</title>
    <style>
        body{
            background-color: #333;
            
            color: aliceblue;
            width: 80%;
        }
        .h1{
            font-size: 3em;
        }
        hr{
            background-color: #111;
            padding: 5px 2px;
        }
        
    </style>
</head>
<body>
    <h1 class="h1">Prest</h1>
    <h3>项目地址：https://gitee.com/Furau/Prest</h3>
    <div>
        <span>作者:Furau.com</span>
    </div>
    <hr>
    <strong>
    .htaccess 文件内容 <br>  
    <?php 
    $filename = ".htaccess"; 
    $handle = fopen($filename, "r");//读取二进制文件时，需要将第二个参数设置成'rb' 
    
    //通过filesize获得文件大小，将整个文件一下子读到一个字符串中 
    $contents = fread($handle, filesize ($filename)); 
    print_r($contents);
    fclose($handle); 
?> 
    </strong>
    <hr>
    <h2>URL</h2>
    <ul class="urllist">
        <li class="item">
            <a href="http://127.0.0.1/prest/">http://127.0.0.1/prest/</a>
        </li>
    </ul>
    <hr>
</body>
</html>

<?php
$htaccess_file = '.htaccess';
$htaccess_content = 'RewriteEngine On' . PHP_EOL;
$htaccess_content .= 'RewriteRule ^index.html$ index.php [L]' . PHP_EOL;
if (file_put_contents($htaccess_file, $htaccess_content) !== false) {
    // 写入成功
} else {
    // 写入失败
}
?>


